#ifndef TCPCI_CONFIG_H
#define TCPCI_CONFIG_H

#define CONFIG_TCPC_CLASS                           1
#if CONFIG_TCPC_CLASS
#define CONFIG_TYPEC_USE_DIS_VBUS_CTRL              0 // vbus ctrl

#define CONFIG_TYPEC_CAP_TRY_SOURCE                 0
#define CONFIG_TYPEC_CAP_TRY_SINK                   1

#define CONFIG_TYPEC_CAP_DBGACC                     0
#define CONFIG_TYPEC_CAP_DBGACC_SNK                 0
#define CONFIG_TYPEC_CAP_CUSTOM_SRC                 0
#define CONFIG_TYPEC_CAP_NORP_SRC                   0 // A-to-C No Rp cable

#define CONFIG_RECV_BAT_ABSENT_NOTIFY               0 // of no use

#define CONFIG_TYPEC_ATTACHED_SRC_SAFE0V_DELAY      0 // postpone src vsafe0v handler
#define CONFIG_TYPEC_ATTACHED_SRC_SAFE0V_TIMEOUT    1 // discharge and wait for vsafe0v

#define CONFIG_TYPEC_SNK_DETACH_IGNORE_VBUS         0 // snk detect attach only via cc
#define CONFIG_TYPEC_VBUS_CC_SHORT                  0

#define CONFIG_TYPEC_LEGACY3_ALWAYS_LOCAL_RP        0 // of no use
#define CONFIG_TYPEC_CAP_RA_DETACH                  0 // of no use
#define CONFIG_TYPEC_CAP_LPM_WAKEUP_WATCHDOG        0 // of no use
#define CONFIG_TYPEC_CAP_ROLE_SWAP                  0 // offer typec role change interface
#define CONFIG_TYPEC_CAP_ROLE_SWAP_TOUT             1200

#define CONFIG_TYPEC_CAP_DISCHARGE_TOUT             300
#define CONFIG_TYPEC_CAP_AUTO_DISCHARGE             0 // of no use
#define CONFIG_TCPC_AUTO_DISCHARGE_IC               0
#define CONFIG_TYPEC_CAP_FORCE_DISCHARGE            1
#define CONFIG_TCPC_FORCE_DISCHARGE_IC              1
#define CONFIG_TCPC_FORCE_DISCHARGE_EXT             0 // of no use

#define CONFIG_TYPEC_CAP_AUDIO_ACC_SINK_VBUS        1 // [SRC.Ra, SRC.Ra]

#define CONFIG_TYPEC_NOTIFY_ATTACHWAIT_SNK          0 // of no use
#define CONFIG_TYPEC_NOTIFY_ATTACHWAIT_SRC          0 // of no use

#define CONFIG_TCPC_ATTACH_WAKE_LOCK_TOUT           5000 // of no use

#define CONFIG_TCPC_LOG_WITH_PORT_NAME              0
#if CONFIG_TCPC_LOG_WITH_PORT_NAME
#define CONFIG_TCPC_DBG_PRESTR                      "{%s}TCPC-"
#else
#define CONFIG_TCPC_DBG_PRESTR                      "TCPC-"
#endif

/*
 * USB 2.0 & 3.0 current
 * Unconfigured :   100 / 150 mA
 * Configured :     500 / 900 mA
 * http://www.testusb.com/power_issue.htm
 */
#define CONFIG_TYPEC_SNK_CURR_DFT                   100
#define CONFIG_TYPEC_SRC_CURR_DFT                   500
#define CONFIG_TYPEC_SNK_CURR_LIMIT                 0

#define CONFIG_TCPC_VCONN_SUPPLY_MODE               0 // of no use
#define CONFIG_TCPC_LOW_POWER_MODE                  1
#define CONFIG_TCPC_CLOCK_GATING                    0 // of no use
#define CONFIG_TCPC_WATCHDOG_EN                     0 // of no use
#define CONFIG_TCPC_INTRST_EN                       0 // of no use
#define CONFIG_TCPC_I2CRST_EN                       0 // of no use

#define CONFIG_TCPC_SHUTDOWN_CC_DETACH              1
#define CONFIG_TCPC_SHUTDOWN_VBUS_DISABLE           1

#define CONFIG_TCPC_NOTIFICATION_NON_BLOCKING       0 // of no use

#define CONFIG_USB_POWER_DELIVERY                   1

#if  CONFIG_USB_POWER_DELIVERY
#include "tcpci_pd_config.h"
#else /* No CONFIG_USB_POWER_DELIVERY */
/* Experimental for CodeSize */
#define CONFIG_USB_PD_DR_SWAP           0
#define CONFIG_USB_PD_PR_SWAP           0
#define CONFIG_USB_PD_VCONN_SWAP        0
#define CONFIG_USB_PD_PE_SINK           0
#define CONFIG_USB_PD_PE_SOURCE         0
#define CONFIG_USB_PD_DISABLE_PE        0

#define CONFIG_USB_PD_TCPM_CB_RETRY     0
#define CONFIG_USB_PD_TCPM_CB_2ND       0
#define CONFIG_USB_PD_BLOCK_TCPM        0

/**********************************************************
 * PD revision 3.0 feature
 **********************************************************/

#define CONFIG_USB_PD_REV30	0

#define CONFIG_USB_PD_REV30_SYNC_SPEC_REV           0
#define CONFIG_USB_PD_REV30_SRC_FLOW_DELAY_STARTUP  0
#define CONFIG_USB_PD_REV30_SNK_FLOW_DELAY_STARTUP  0
#define CONFIG_USB_PD_REV30_SRC_CAP_EXT_LOCAL       0
#define CONFIG_USB_PD_REV30_SRC_CAP_EXT_REMOTE      0
#define CONFIG_USB_PD_REV30_BAT_CAP_LOCAL           0
#define CONFIG_USB_PD_REV30_BAT_CAP_REMOTE          0
#define CONFIG_USB_PD_REV30_BAT_STATUS_LOCAL        0
#define CONFIG_USB_PD_REV30_BAT_STATUS_REMOTE       0
#define CONFIG_USB_PD_REV30_MFRS_INFO_LOCAL         0
#define CONFIG_USB_PD_REV30_MFRS_INFO_REMOTE        0
#define CONFIG_USB_PD_REV30_COUNTRY_CODE_LOCAL      0
#define CONFIG_USB_PD_REV30_COUNTRY_CODE_REMOTE     0
#define CONFIG_USB_PD_REV30_COUNTRY_INFO_LOCAL      0
#define CONFIG_USB_PD_REV30_COUNTRY_INFO_REMOTE     0
#define CONFIG_USB_PD_REV30_ALERT_LOCAL             0
#define CONFIG_USB_PD_REV30_ALERT_REMOTE            0
#define CONFIG_USB_PD_REV30_STATUS_LOCAL            0
#define CONFIG_USB_PD_REV30_STATUS_REMOTE           0
#define CONFIG_USB_PD_REV30_CHUNKING_BY_PE          0
#define CONFIG_USB_PD_REV30_PPS_SINK                0
#define CONFIG_USB_PD_REV30_PPS_SOURCE              0
#define CONFIG_USB_PD_REV30_STATUS_LOCAL_TEMP       0
#define CONFIG_USB_PD_REV30_BAT_INFO                0
#define CONFIG_USB_PD_REV30_COUNTRY_AUTHORITY       0
#define CONFIG_USB_PD_DPM_AUTO_SEND_ALERT           0
#define CONFIG_USB_PD_DPM_AUTO_GET_STATUS           0
#define CONFIG_MTK_HANDLE_PPS_TIMEOUT               0

/* CONFIG_USB_PD_REV30 */

/**********************************************************
 * PD direct charge support
 **********************************************************/

//#define CONFIG_USB_PD_DIRECT_CHARGE               0
#define CONFIG_USB_PD_KEEP_PARTNER_ID               0
#define CONFIG_USB_PD_KEEP_SVIDS                    0
#define CONFIG_USB_PD_SRC_STARTUP_DISCOVER_ID       0
#define CONFIG_USB_PD_DFP_READY_DISCOVER_ID         0
#define CONFIG_USB_PD_RESET_CABLE                   0
#define CONFIG_USB_PD_RANDOM_FLOW_DELAY             0
#define CONFIG_USB_PD_DFP_FLOW_DELAY                0
#define CONFIG_USB_PD_DFP_FLOW_DELAY_STARTUP        0
#define CONFIG_USB_PD_DFP_FLOW_DELAY_DRSWAP         0
#define CONFIG_USB_PD_DFP_FLOW_DELAY_RESET          0

#define CONFIG_USB_PD_DISCARD_AND_UNEXPECT_MSG      0

/* Only in startup */
#define CONFIG_USB_PD_UFP_FLOW_DELAY                0
#define CONFIG_USB_PD_VCONN_STABLE_DELAY            0
#define CONFIG_USB_PD_VCONN_SAFE5V_ONLY             0

#define CONFIG_USB_PD_ATTEMPT_DISCOVER_ID           0
#define CONFIG_USB_PD_ATTEMPT_DISCOVER_SVIDS        0

#define CONFIG_USB_PD_DISCOVER_CABLE_REQUEST_VCONN  0
#define CONFIG_USB_PD_DISCOVER_CABLE_RETURN_VCONN   0

#define CONFIG_USB_PD_PR_SWAP_ERROR_RECOVERY        0

#define CONFIG_USB_PD_CUSTOM_DBGACC                 0
#define CONFIG_USB_PD_SNK_DFT_NO_GOOD_CRC           0
#define CONFIG_USB_PD_IGNORE_PS_RDY_AFTER_PR_SWAP   0
#define CONFIG_USB_PD_CHECK_RX_PENDING_IF_SRTOUT    0
//#define CONFIG_USB_PD_RENEGOTIATION_COUNTER       0
#define CONFIG_USB_PD_ERROR_RECOVERY_ONCE           0

#define CONFIG_USB_PD_IGNORE_HRESET_COMPLETE_TIMER  0
#define CONFIG_USB_PD_RETRY_HRESET                  0
#define CONFIG_USB_PD_DROP_REPEAT_PING              0
#define CONFIG_USB_PD_CHECK_DATA_ROLE               0
#define CONFIG_USB_PD_RETRY_CRC_DISCARD             0
#define CONFIG_USB_PD_PARTNER_CTRL_MSG_FIRST        0

#define CONFIG_USB_PD_SNK_IGNORE_HRESET_IF_TYPEC_ONLY    0
#define CONFIG_USB_PD_SNK_STANDBY_POWER             0
#define CONFIG_USB_PD_SNK_GOTOMIN                   0

#define CONFIG_USB_PD_SRC_HIGHCAP_POWER             0
#define CONFIG_USB_PD_SRC_TRY_PR_SWAP_IF_BAD_PW     0
#define CONFIG_USB_PD_SRC_REJECT_PR_SWAP_IF_GOOD_PW 0

#define CONFIG_USB_PD_TRANSMIT_BIST2                0

#define CONFIG_USB_PD_SAFE0V_DELAY                  0
#define CONFIG_USB_PD_SAFE0V_TIMEOUT                0
#define CONFIG_USB_PD_SAFE5V_DELAY                  0

#define CONFIG_USB_PD_DPM_SVDM_RETRY                0
#define CONFIG_USB_PD_DFP_FLOW_RETRY_MAX            0
#define CONFIG_USB_PD_VBUS_STABLE_TOUT              0
#define CONFIG_USB_PD_CUSTOM_VDM_TOUT               0
#define CONFIG_USB_PD_VCONN_READY_TOUT              0
#define CONFIG_USB_PD_DFP_FLOW_DLY                  0
#define CONFIG_USB_PD_UFP_FLOW_DLY                  0
#define CONFIG_USB_PD_PPS_REQUEST_INTERVAL          0
#define CONFIG_USB_PD_WAIT_BC12                     0
#endif /* CONFIG_USB_POWER_DELIVERY */

#define CONFIG_USB_PD_DBG_ALWAYS_LOCAL_RP           0
#define CONFIG_USB_PD_DBG_IGRONE_TIMEOUT            0

#define CONFIG_USB_PD_DBG_DP_DFP_D_AUTO_UPDATE      0
#define CONFIG_USB_PD_DBG_DP_UFP_U_AUTO_UPDATE      0
#define CONFIG_USB_PD_DBG_DP_UFP_U_AUTO_ATTENTION   0

/**********************************************************
 * TypeC Shield Protection
 **********************************************************/
#define CONFIG_WATER_DETECTION                      0

#if CONFIG_WATER_DETECTION
#define CONFIG_WD_SBU_CALIB_INIT                    1800 /* mV */
#define CONFIG_WD_SBU_PL_BOUND                      200 /* mV */
#define CONFIG_WD_SBU_PL_LBOUND_C2C                 1100 /* mV */
#define CONFIG_WD_SBU_PL_UBOUND_C2C                 2600 /* mV */
#define CONFIG_WD_SBU_PL_RETRY                      2
#define CONFIG_WD_SBU_PH_RETRY                      2
#define CONFIG_WD_SBU_PH_AUDDEV                     200 /* mV */
#define CONFIG_WD_SBU_PH_LBOUND                     1180 /* mV */
#define CONFIG_WD_SBU_PH_LBOUND1_C2C                2850 /* mV */
#define CONFIG_WD_SBU_PH_UBOUND1_C2C                3150 /* mV */
#define CONFIG_WD_SBU_PH_UBOUND2_C2C                3800 /* mV */
#define CONFIG_WD_SBU_AUD_UBOUND                    1600 /* mV */
#define CONFIG_WD_PROTECT_RETRY_COUNT               3
#define CONFIG_WD_DURING_PLUGGED_IN                 1
#define CONFIG_WD_SBU_PH_TITAN_LBOUND               1800 /* mV */
#define CONFIG_WD_SBU_PH_TITAN_UBOUND               3000 /* mV */
#endif

#define CONFIG_CABLE_TYPE_DETECTION                 0

#endif /* CONFIG_TCPC_CLASS */
#endif /* TCPCI_CONFIG_H */

